package com.geovis.emergency.spd.entity.command.pojo.vo;


import com.geovis.emergency.spd.entity.command.entity.Tflj;
import com.geovis.emergency.spd.entity.command.entity.Tfyblj;
import com.geovis.emergency.spd.entity.command.enums.TfTypeEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.springframework.beans.BeanUtils;

import java.math.BigDecimal;

/**
 * 台风路径明细Vo对象
 */
@Setter
@Getter
@Accessors(chain = true)
public class TfljDetailVo {

    @ApiModelProperty("主键id")
    private String id;

    @ApiModelProperty("台风编号")
    private String typhoonNo;

    @ApiModelProperty("经度")
    private String longitude;

    @ApiModelProperty("纬度")
    private String latitude;

    @ApiModelProperty("移动方向")
    private String moveDir;

    @ApiModelProperty("移动速度")
    private Integer moveSpeed;

    @ApiModelProperty("台风中心气压")
    private Integer pressure;

    @ApiModelProperty("台风中心风力")
    private Integer power;

    @ApiModelProperty("台风中心风速")
    private Integer speed;

    @ApiModelProperty("时间")
    private String time;

    @ApiModelProperty("7级")
    private String radius7Quad;

    @ApiModelProperty("10级")
    private String radius10Quad;

    @ApiModelProperty("12级")
    private String radius12Quad;

    @ApiModelProperty("预报")
    private String forecast;

    @ApiModelProperty("强度")
    private String strong;


    public static TfljDetailVo fromTfyblj(Tfyblj tfyblj)
    {
        TfljDetailVo vo=new TfljDetailVo();
        BeanUtils.copyProperties(tfyblj,vo);
        vo.setTyphoonNo(tfyblj.getTyphoonId())
                .setLongitude(tfyblj.getLon())
                .setLatitude(tfyblj.getLat())
                .setMoveDir(tfyblj.getMoveDirection())
                .setPressure(new BigDecimal(tfyblj.getCenterPressure()).intValue())
                .setPower(new BigDecimal(tfyblj.getCenterWindPower()).intValue())
                .setSpeed(new BigDecimal(tfyblj.getCenterWindSpeed()).intValue())
                .setStrong(TfTypeEnum.getNameByCode(tfyblj.getType()));
        return vo;

    }

}
